package com.cdl.arrayList;

import com.cdl.iheritance.Employee;

import java.util.ArrayList;

/**
 * @author cdl
 * @date 2025/10/3
 */
public class ArrayListTest {

    public static void main(String[] args) {
        ArrayList<Employee> staff = new ArrayList<Employee>();

        staff.add(new Employee("Carl",7000,1987,12,15));
        staff.add(new Employee("Harry",5000,1989,10,1));
        staff.add(new Employee("Tony",4000,1990,3,15));

        for (Employee employee : staff){
            employee.raiseSalary(10);
        }

        for (Employee e : staff){
            System.out.println("name=" + e.getName() + ",salary=" + e.getSalary() + ",hirDay=" +e.getHireDay());
        }

        System.out.println(staff.get(0).getHireDay().toString());

        staff.set(1,new Employee(" new name",1500,1900,12,1));
        for (Employee e : staff){
            System.out.println("name=" + e.getName() + ",salary=" + e.getSalary() + ",hirDay=" +e.getHireDay());
        }



    }




}
